﻿<UserControl x:Class="Wpf2.Views.UcOrderManagement"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             >
    <StackPanel Height="700" Width="Auto" Orientation="Vertical">
        <StackPanel  x:Name="PanelButtonCatalogs" Grid.Row="0" Margin="0,5,0,5" Width="Auto">
            <ListView Height="50" HorizontalAlignment="Center" Name="lvCatalog" ItemsSource="{Binding}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"   BorderThickness="0" Width="Auto" SelectionChanged="LvCatalogSelectionChanged">
                <ListView.Background>
                    <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.GradientInactiveCaptionColorKey}}"/>
                </ListView.Background>
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
                <ListView.ItemTemplate>
                    <DataTemplate >
                        <Border BorderBrush="Blue" BorderThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center" Background="#FF16499A" >
                            <StackPanel Orientation="Horizontal" Height="30" Width="120" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <Image Source="/Wpf2;component/Images/catalog.png" Width="30" Height="30"/>
                                <TextBlock Text="{Binding CatalogName}" VerticalAlignment="Center" Margin="2,0,0,0" Foreground="#FFFCFCFC"/>
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </ListView.ItemTemplate>

            </ListView>
        </StackPanel>

        <StackPanel Height="50" VerticalAlignment="Center" Width="Auto" Orientation="Horizontal" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
            <StackPanel Orientation="Horizontal">
                <Label Height="30" Margin="5,0,0,0" Content="Loại HĐ:" Background="#FF0050EF" Foreground="White"/>
                <StackPanel Width="100" Height="30"  Orientation="Horizontal" Background="#FF16499A">
                <RadioButton x:Name="rabtnInOrder" Margin="0,7,0,0" IsChecked="True" Checked="RabtnInOrderChecked" Foreground="White">
                    <WrapPanel>
                        <TextBlock Text="Nhập" Foreground="White" />
                    </WrapPanel>
                </RadioButton>
                <RadioButton x:Name="rabtnOutOrder" Margin="5,7,0,0" Checked="RabtnInOrderChecked">
                    <WrapPanel>
                        <TextBlock Text="Xuất" Foreground="White" />
                    </WrapPanel>
                </RadioButton>
                </StackPanel>
            </StackPanel>
            <WrapPanel Margin="20,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
                <Label Height="30" Content="Từ: " Background="#FF0050EF" Foreground="White"></Label>
                <DatePicker  Padding="5" Height="30" x:Name="dpickerFrom" HorizontalAlignment="Left" VerticalAlignment="Center"  Width="120" Margin="0,0,20,0" SelectedDateChanged="DpickerSelectedDateChanged" Background="#FF16499A"/>
                <Label Height="30" Content="Đến: " Foreground="White" Background="#FF0050EF"></Label>
                <DatePicker Height="30" Padding="5" x:Name="dpickerTo" HorizontalAlignment="Left" VerticalAlignment="Center"  Width="120" Margin="0,0,20,0" SelectedDateChanged="DpickerSelectedDateChanged" Background="#FF16499A"/>
                <StackPanel Orientation="Horizontal">
                    <Label Height="30" Content="Tên KH:"  Background="#FF0050EF" Foreground="White" />
                    <Grid Height="30">
                        <TextBox Padding="5" Name="txtCustomerName" Text="" FontSize="16" HorizontalAlignment="Left" Background="#FF0050EF" Height="30" Width="100" Margin="0,0,0,0" Foreground="#FFFCFCFC"/>
                        <!--<ComboBox Name="cmbSearchByName"  Visibility="Hidden"  IsTabStop="False" IsSynchronizedWithCurrentItem="True" SelectionChanged="cmbSearchByName_SelectionChanged" ></ComboBox>-->
                    </Grid>
                    <Button Height="30" Width="40" HorizontalAlignment="Left" Margin="0,10" Click="BtnSearchByNameClick" Background="#FF16499A">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Wpf2;component/Images/searchicon.png" Width="20" Height="20"/>
                        </StackPanel>
                    </Button>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Label Height="30" Content="Mã NV:"  Background="#FF0050EF" Foreground="White" />
                    <Grid Height="30">
                        <TextBox Padding="5" Name="txtUserName" Text="" FontSize="16" HorizontalAlignment="Left" Background="#FF0050EF" Height="30" Width="100" Margin="0,0,0,0" Foreground="#FFFCFCFC"/>
                        <!--<ComboBox Name="cmbSearchByName"  Visibility="Hidden"  IsTabStop="False" IsSynchronizedWithCurrentItem="True" SelectionChanged="cmbSearchByName_SelectionChanged" ></ComboBox>-->
                    </Grid>
                    <Button Height="30" Width="40" HorizontalAlignment="Left" Margin="0,10" Click="BtnSearchByUserClick" Background="#FF16499A">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="/Wpf2;component/Images/searchicon.png" Width="20" Height="20"/>
                        </StackPanel>
                    </Button>
                </StackPanel>
            </WrapPanel>
        </StackPanel>

        <DataGrid VerticalAlignment="Center"  HorizontalContentAlignment="Center" Grid.Row="2" x:Name="dtgOrderManagement" Height="550" AutoGenerateColumns="False" SelectedIndex="0" CanUserAddRows="False" AlternatingRowBackground="PaleTurquoise"> 
            <DataGrid.RowHeaderTemplate>
                <DataTemplate>
                    <TextBlock  Width="20" Text="{Binding Header, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}, Mode=FindAncestor}}"/>
                </DataTemplate>
            </DataGrid.RowHeaderTemplate>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Ngày lập" Width="200" Binding="{Binding DDateOrder}"/>
                <DataGridTextColumn Header="Khách hàng" Width="150" Binding="{Binding SCustomerName}"/>
                <DataGridTextColumn Header="Tình trạng" Width="150" Binding="{Binding SStatus}"/>
                <DataGridTextColumn Header="Loại hóa đơn" Width="120" Binding="{Binding OrderTypeToString}"/>
                <DataGridTemplateColumn Header="Sửa" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Click="BtnEditOrderClick">
                                <Image Source="..\Images\edit.png" Height="20" Width="20"/>
                            </Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </StackPanel>
</UserControl>
